<template>
  <div class="app-container">
    <div class="m-item-warp">
      <div class="title">我的账号</div>
      <div class="item">
        <div class="tips">登录账号：</div>
        <div class="val">
          {{ userObj.userName }}
        </div>
      </div>
      <div class="item">
        <div class="tips">登录密码：</div>
        <div class="val opn_warp">
          {{ userObj.password | passwordFilters }}
          <div class="btn" @click="editClick">修改</div>
        </div>
      </div>
      <div class="item">
        <div class="tips ">手机号：</div>
        <div class="val">
          {{ userObj.phoneNum | phoneFilters }}
        </div>
      </div>
    </div>
    <div class="m-item-warp">
      <div class="title">管理员信息
        <el-tooltip class="tooltip1" effect="dark" content="创建账号或修改密码可联系管理员" placement="right">
          <i class="el-icon-info"></i>
        </el-tooltip>
      </div>
      <div class="item">
        <div class="tips">账号名称：</div>
        <div class="val">
          {{ userObj.userName }}
        </div>
      </div>
      <div class="item">
        <div class="tips">手机号：</div>
        <div class="val">
          {{ userObj.phoneNum | phoneFilters }}
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { mapGetters } from 'vuex'

export default {
  data() {
    return {
      administrators: {},
    }
  },
  filters: {
    passwordFilters(e) {
      return `******`
    },
    phoneFilters(e) {
      let str = ''
      if (!e) {
        return '--'
      }
      return `${e.slice(0, 2)}****${e.slice(-5)}`
    },
  },
  computed: {
    ...mapGetters([
      'introduction',
    ]),
    userObj() {
      return this.introduction || {}
    },
    adminObj() {
      return this.administrators || {}
    },
    role() {
      // 角色判断
      // 1爵奇管理员，2爵奇操作员，3品牌商管理员，4品牌商操作员
      if (this.introduction?.role) { }
    },
    menufacturerId() {
      // 制造商Id, 获取管理员信息
      if (this.introduction?.menufacturerId) { }
    }
  },
  created() {
  },
  methods: {
    editClick() {
      this.$router.push('/my/index/change-password')
    }
  }
}
</script>
<style scoped lang="scss">
.app-container {
  padding: 20px;
}

.m-item-warp {
  background-color: #fff;
  padding: 24px 20px 48px;
  border-radius: 16px;

  &:first-of-type {
    margin-bottom: 20px;
  }

  .title {
    font-size: 18px;
    font-weight: 500;
    line-height: 24px;
    color: #15181D;
    padding-bottom: 32px;
  }

  .tooltip1 {
    margin-left: 20px;
  }

  .item {
    padding-bottom: 24px;
    display: flex;
    align-items: center;

    &:last-of-type {
      padding-bottom: 0;
    }

    font-size: 14px;
    font-weight: normal;
    line-height: 18px;
    color: #8B8B8B;

    .tips {
      min-width: 90px;
    }

    .val {
      color: #15181D;
    }

    .opn_warp {
      display: flex;
      align-items: center;

      .btn {
        cursor: pointer;
        color: #C27B55;
        padding-left: 26px;
      }
    }
  }
}
</style>